package com.itheima.wms.service.impl;

import com.itheima.wms.common.service.CrudServiceImpl;
import com.itheima.wms.common.utils.RelationUtils;
import com.itheima.wms.dao.GoodsMapper;
import com.itheima.wms.dao.GoodsTypeMapper;
import com.itheima.wms.entity.GoodsTypeEntity;
import com.itheima.wms.service.GoodsTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;


/**
 * <p>
 * 业务实现类
 * 货品类型管理
 * </p>
 */
@Slf4j
@Service
public class GoodsTypeServiceImpl extends CrudServiceImpl<GoodsTypeMapper, GoodsTypeEntity> implements GoodsTypeService {
    private static List<Class> SERVICE = new ArrayList() {{
        add(GoodsMapper.class);
    }};


    @Override
    public boolean removeByIds(Collection<? extends Serializable> idList) {
        idList.forEach(id -> {
            RelationUtils.checkRelation(id, "goods_type_id", SERVICE);
        });
        return super.removeByIds(idList);
    }

}

